package org.bot.plugin.web.event;

import org.bot.api.event.DataStorage;
import org.bot.api.event.EventName;
import org.bot.api.event.Events;
import org.bot.api.flow.FlowNode;
import org.bot.plugin.web.util.SelectorType;
import org.bot.plugin.web.util.WebApi;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @author 沧月
 * @create 0028 2023/9/28 09:57
 * @description <description class purpose>
 */
@Component
@EventName("获取HTML文本")
public class WebGetHtml implements Events {

    @Autowired
    WebApi webApi;

    @Override
    public Object exec(FlowNode node, DataStorage data) {
        return webApi.getHtml(webApi.getWebDriver(node), SelectorType.getType(node.getSelectorType()), node.getArg());
    }

}
